package com.qfmy.controller.novel;

import com.qfmy.service.novel.CategoryService;
import com.qfmy.vo.novel.CategoryVo;
import common.result.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.controller.novel
 * @date 2025/6/6
 * @description 分类控制类
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/category")
public class CategoryController {

    /**
     * 获取分类列表
     */
    @Resource
    private CategoryService categoryService;

    /**
     * 获取所有的分类标签
     */
    @RequestMapping("/getAllCategoryTags")
    public Result<List<String>> getAllCategory(){
        List<String> categoryList = categoryService.getAllCategoryTags();
        return Result.ok(categoryList);
    }

    /**
     * 根据类型获取分类小说
     */
    @RequestMapping("/getCategoryNovels")
    public Result<List<CategoryVo>> getCategoryNovels(@RequestParam Integer type){
        List<CategoryVo> categoryList = categoryService.getCategoryNovels(type);
        return Result.ok(categoryList);

    }

}
